package com.cn.yugan.Utils;

/**
 * Created by Rover on 2016/8/8 .
 * Email 357319517@qq.com
 * <p/>
 * 该工具类目的是为了识别账号的类型，比如电话号码、邮箱、用户名、UID等。
 * 暂时只用电话号码和邮箱地址
 */

public abstract class AccountType {


    public static boolean IsPhone(String account) {
        int count = 0;
        for (char c : account.toCharArray()) {
            if (c >= '0' && c <= '9') {
                System.out.println(c + "");
                count++;
            } else {
                break;
            }
        }
        if (count == 11) {
            return true;
        } else {
            return false;
        }
    }

    public static boolean IsEmail(String account) {
        if (account.contains("@")) {
            if (account.indexOf('@') == account.lastIndexOf('@')) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }


}
